package com.itheima.fanshe;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/*
可以调用 私有方法了
 */
public class Demo02 {

    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {

        Kunkun kunkun = new Kunkun();
       // kunkun.dance();
        Class<Kunkun> clazz = (Class<Kunkun>) kunkun.getClass();
        Method method = clazz.getDeclaredMethod("dance");
        method.setAccessible(true);
        method.invoke(kunkun);

    }
}
